import request, {commonUrl, Method} from '@/plugins/request.js';

/**
 * 获取拼图驗證
 */
export function getVerifyImg(verificationEnums) {
  return request({
    url: `${commonUrl}/common/common/slider/${verificationEnums}`,
    method: Method.GET,
    needToken: false
  });
}

/**
 * 驗證碼校验
 */
export function postVerifyImg(params) {
  return request({
    url: `${commonUrl}/common/common/slider/${params.verificationEnums}`,
    method: Method.POST,
    needToken: false,
    params
  });
}

/**
 * 發送短信驗證碼
 */
export function sendSms(params) {
  return request({
    url: `${commonUrl}/common/common/sms/${params.verificationEnums}/${params.mobile}`,
    method: Method.GET,
    needToken: false,
    params
  });
}

// 地區數据，用於三级聯動
export function getRegion(id) {
  return request({
    url: `${commonUrl}/common/common/region/item/${id}`,
    needToken: true,
    method: Method.GET
  });
}

/**
 * 分頁获取文章列表
 * @param cateId 文章分類id
 */
export function articleList(params) {
  return request({
    url: `/buyer/other/article`,
    method: Method.GET,
    params
  });
}

/**
 * 获取帮助中心文章分類列表
 * @param cateId 文章分類id
 */
export function articleCateList() {
  return request({
    url: `/buyer/other/article/articleCategory/list`,
    method: Method.GET
  });
}

// 通过id获取文章
export function articleDetail(id) {
  return request({
    url: `/buyer/other/article/get/${id}`,
    method: Method.GET
  });
}


// 获取IM接口前缀
export function getIMDetail() {
  return request({
    url: `${commonUrl}/common/common/IM`,
    method: Method.GET
  });
}


//获取图片logo
export function getBaseSite() {
  return request({
    url: `${commonUrl}/common/common/site`,
    method: Method.GET,
    needToken: false
  })
}

// 获取oss文件资源
export const findOssFile = (params) => {
  return request({
    url: `${commonUrl}/common/common/file`,
    method: Method.GET,
    params
  })
};


// 根据域名获取店铺ID
export const findStoreByHost = (params) => {
  return request({
    url: `${commonUrl}/common/common/store/host/` + params,
    method: Method.GET,
    params
  })
};

// 获取当前域名店铺信息
export function findStoreName() {
  return request({
    url: `${commonUrl}/common/common/store/`,
    method: Method.GET,
    needToken: true
  })
}
